package com.mgface.framework.filter;

import java.io.IOException;
import java.time.LocalDateTime;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


@WebFilter(asyncSupported = true,urlPatterns="/sbdfilter",filterName="OrRequestMatcher")
public class SBDFilter implements Filter {
	private static final Logger log = LogManager.getLogger(SBDFilter.class);
	@Override
	public void destroy() {
		log.info(this.getClass().getSimpleName()+" filter destory 完成 <{}>",LocalDateTime.now());
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
			throws IOException, ServletException {
		log.info(this.getClass().getSimpleName()+" do filter <{}>",LocalDateTime.now());
		arg2.doFilter(arg0, arg1);
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		log.info(this.getClass().getSimpleName()+" filter init 完成 <{}>",LocalDateTime.now());
	}

}
